//
// Created by wze-zero on 2024/8/20 020.
//
#include <iostream>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    cout << (((n + m) % 7) == 0 ? 7 : (n + m) % 7) << endl;
    return 0;
}